package hash;

/**
 * @author 十八岁讨厌编程
 * @date 2025/6/27 21:17
 * @PROJECT_NAME leetcode
 * @description
 */

public class Solution383 {

    public boolean canConstruct(String ransomNote, String magazine) {
        int[] records = new int[26];
        for (int i = 0; i < ransomNote.length(); i++) records[ransomNote.charAt(i) - 'a']++;
        for (int i = 0; i < magazine.length(); i++) records[magazine.charAt(i) - 'a']--;
        for (int i = 0; i < records.length; i++) if (records[i] > 0) return false;
        return true;
    }

}
